const data = global.get('_ELECTRIC_STATISTICS_').byTimeDimension;

// 从数据中移除 hourly 和 daily 维度
const { hourly, daily, ...filteredData } = data;

// 处理数据，只保留 consumption 值
const processedData = Object.entries(filteredData).reduce((acc, [dimension, dimensionData]) => {
    acc[dimension] = Object.entries(dimensionData).reduce((dates, [date, dateData]) => {
        dates[date] = Object.entries(dateData).reduce((points, [pointId, pointData]) => {
            points[pointId] = pointData.consumption;
            return points;
        }, {});
        return dates;
    }, {});
    return acc;
}, {});

// 准备统一响应格式
const responseData = {
    success: true,
    code: 200,
    result: processedData
};

// 推送结果
msg.payload = responseData;
return msg;